﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;
using System.ComponentModel;
using ScrumTable.Common;
using ScrumTable.DL.Data.Schema;

#endregion

namespace ScrumTable.DL.Data.Common
{
    /// <summary>
    /// This event arguments provide additional information about a value
    /// change event and its corresponding data.
    /// </summary>
    public class DataObjectValueEventArgs : PropertyChangedEventArgs
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Specifies the property which changed.
        /// </summary>
        public SchemaBase ValueProperty { get; private set; }

        /// <summary>
        /// Specifies the data access object above the changed object.
        /// </summary>
        public IDataAccessObject DataAccessObject { get; private set; }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new DataObjectValueEventArgs instance with the
        /// additional event data.
        /// </summary>
        /// <param name="dataAccessObject">Specifies the parent data access object of the origin.</param>
        /// <param name="valueProperty">Specifies the property which changed.</param>
        public DataObjectValueEventArgs(IDataAccessObject dataAccessObject, SchemaBase valueProperty)
            : base(valueProperty.SchemaName)
        {
            PreCondition.AssertNotNull(dataAccessObject, "dataAccessObject");
            PreCondition.AssertNotNull(valueProperty, "valueProperty");

            DataAccessObject = dataAccessObject;
            ValueProperty = valueProperty;
        }

        #endregion
    }

}